package cn.edu.nju.software.cdiy.interceptor;

import java.util.Map;

import cn.edu.nju.software.cdiy.util.BusinessConstant;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

@SuppressWarnings("serial")
public class UserLoginInterceptor extends AbstractInterceptor {

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		Map<String, Object> session = invocation.getInvocationContext().getSession();

		if (!session.containsKey(BusinessConstant.S_USER)) {
			return Action.LOGIN;
		}
		
		return invocation.invoke();
	}

}
